<?php
/**
 *author:栗超
 *address:2788547340@qq.com
 * 2016/9/4 15:28
 */  
namespace Common\Model;
use Hdphp\Model\Model;

class Address extends Model{
    protected $table='address';
//    自动验证
    protected $validate=array(
        array('aname','required','收货人名字不能为空',3,1),
        array('aphone','required','收货人电话不能为空',3,1),
        array('aaddress','required','地址不能为空',3,1),
        array('amail','required','邮箱不能为空',3,1)
    );
    public function store(){
        if($this->create()){
            $this->data['user_uid']=$_SESSION['uid'];
            $this->data['aaddress']=implode(',',Q('post.aaddress') ).Q('post.address-detail');
//            p($this->data);
            $data = $this->data;
            $aid=$this->add();
            $data['aid']=$aid;
            return $data;
        }
        return false;
    }
}